import java.util.*;

public class Leet301 {
    public static void main(String[] args) {
        Leet301 l = new Leet301();
        System.out.println(l.removeInvalidParentheses(")("));
    }
    List<String> list;
    int min;
    public List<String> removeInvalidParentheses(String s) {
        min = 100;
        list = new ArrayList<>();
        char[] chs = s.toCharArray();
        int all = s.length();
        dfs(s.toCharArray(),0,0,0);
        Set<String> re = new HashSet<>();
        for (String s1 : list) {
            if (s1.length()==all-min)
                re.add(s1);
        }
        if (re.size()!=0)
            return new ArrayList<>(re);
        else {
            StringBuilder sb = new StringBuilder();
            for (char ch : chs) {
                if (ch!='('&&ch!=')')
                    sb.append(ch);
            }
            return Collections.singletonList(sb.toString());
        }
    }
    void dfs(char[] chs,int now, int delNum,int l){
        if (delNum>min)
            return;
        if (check(chs)){
            StringBuilder sb = new StringBuilder();
            for (char ch : chs) {
                if (ch!=' ')
                    sb.append(ch);
            }
            min = Math.min(delNum,min);
            list.add(sb.toString());
        }
        char c;
        for (int i = now; i < chs.length; i++) {
            if (chs[i]=='(')
                l++;
            else if (chs[i]==')')
                l--;
            else continue;
            if (l==-1&&chs[i]==')'){
                l++;
                c = chs[i];
                chs[i] = ' ';
                dfs(chs,i+1,delNum+1,l);
                chs[i] = c;
                continue;
            }else if (l==-1)
                continue;
            c = chs[i];
            chs[i] = ' ';
            dfs(chs,i+1,delNum+1,l);
            chs[i] = c;
            dfs(chs,i+1,delNum,l);
        }
    }
    boolean check(char[] chs){
        int l = 0;
        for (char ch : chs) {
            if (ch=='(')
                l++;
            else if (ch==')')
                l--;
            if (l<0)
                return false;
        }
        return l == 0;
    }
}
